package com.ssy.lingxi.platform.manage.entity.base;

import com.fasterxml.jackson.annotation.JsonBackReference;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
 * 商城规则-商城关联类
 * @author wyx
 * @version 2.0.0template/web/memberChannelWeb/saveCurrMemberChannel
 * @date 2021-09-24
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "man_shop_rule_detail",
        indexes = {@Index(name = "man_shop_rule_detail_shop_id_idx", columnList = "shopId")})
public class ShopRuleDetail {

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "shop_rule_detail_seq")
    @SequenceGenerator(sequenceName = "man_shop_rule_detail_seq", name = "shop_rule_detail_seq", allocationSize = 1,initialValue = 1001)
    private Long id;

    /**
     * 商城ID
     */
    @Column
    private Long shopId;

    /**
     * 商城名称
     */
    @Column
    private String name;

    /**
     * 商城类型: 1.企业商城 2.积分商城 3.渠道商城 4.渠道自有商城 5.渠道积分商城 6.采购门户 7.物流服务门户 8.加工服务门户 9.行情资讯门户
     */
    @Column
    private Integer type;

    /**
     * 商城环境:1.web 2.H5 3.小程序 4.APP
     */
    @Column
    private Integer environment;

    /**
     * 商城属性: 1.B端商城 2.C端商城 3.B端自营商城 4.C端自营商城
     */
    @Column
    private Integer property;

    /**
     * 是否由会员来运营行情资讯门户：0.否；1.是；
     */
    @Column
    private Integer memberOperate;

    /**
     * 商城LOGO
     */
    @Column
    private String logoUrl;

    /**
     * 商城描述
     */
    @Column
    private String describe;

    /**
     * 状态 1.有效 0.无效
     */
    @Column
    private Integer state;

    /**
     * 商城链接
     */
    @Column
    private String url;

    /**
     * 是否默认：0:否 1.是
     */
    @Column
    private Integer isDefault;

    /**
     * 创建时间
     */
    @Column
    private Long createTime = System.currentTimeMillis();

    /**
     * 多对一双向关联商城规则
     */
    @JsonBackReference
    @ManyToOne(cascade = {CascadeType.DETACH}, fetch = FetchType.LAZY)
    @JoinColumn(name = "shop_rule_id", referencedColumnName = "id")
    private ShopRule shopRule;
}
